use proc_macro2::TokenStream;
use quote::ToTokens;
use syn::Item;
use syn::Ident;


pub fn gen_rust_types(item: Item) -> Option<(Ident, TokenStream)>{
    if let syn::Item::Struct(item) = item {
        match item.vis {
            syn::Visibility::Public(_) => {}
            _ => return None,
        };
        return Some((item.ident.clone(), item.into_token_stream()));
    } else if let syn::Item::Impl(_item) = item {
        // TODO gen impl token
        // if types_name.contains(item.i)
        // types_token.push(item.into_token_stream());
    } else if let syn::Item::Type(item) = item {
        match item.vis {
            syn::Visibility::Public(_) => {}
            _ => return None,
        };
        return Some((item.ident.clone(), item.into_token_stream()));
    }else if let syn::Item::Trait(item) = item {
        match item.vis {
            syn::Visibility::Public(_) => {}
            _ => return None,
        };

        return Some((item.ident.clone(), item.into_token_stream()));
    } else if let syn::Item::TraitAlias(item) = item {
        match item.vis {
            syn::Visibility::Public(_) => {}
            _ => return None,
        };

        return Some((item.ident.clone(), item.into_token_stream()));
    } else if let syn::Item::Enum(item) = item {
        match item.vis {
            syn::Visibility::Public(_) => {}
            _ => return None,
        };

        return Some((item.ident.clone(), item.into_token_stream()));
    }
    return None;
}

